{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b4ec2327",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "整型变量a1： 128\n",
      "整型变量a2:  -253\n",
      "46\n",
      "-86\n",
      "-86.26\n",
      "640000000.0\n",
      "(8+9j)\n",
      "------------\n",
      "整型转换成浮点类型： 128.0\n",
      "浮点型类型a6转换成功整型： 640000000\n",
      "整型类型转换成复数类型： (128+0j)\n",
      "(128-86.26j)\n"
     ]
    }
   ],
   "source": [
    "a1 = 128\n",
    "a2 = -253\n",
    "a3 = 0o56\n",
    "a4 = -0x56\n",
    "a5 = -86.26\n",
    "a6 = 6.4E+8\n",
    "a7 = 8+9j\n",
    "print(\"整型变量a1：\",a1)\n",
    "print(\"整型变量a2: \",a2)\n",
    "print(a3)\n",
    "print(a4)\n",
    "print(a5)\n",
    "print(a6)\n",
    "print(a7)\n",
    "print(\"------------\")\n",
    "print(\"整型转换成浮点类型：\",float(a1))\n",
    "print(\"浮点型类型a6转换成功整型：\",int(a6))\n",
    "print(\"整型类型转换成复数类型：\",complex(a1))\n",
    "print(complex(a1,a5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "22fdc351",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "字符串变量str1: I like Python and Pandas!\n",
      "字符串变量str2: I am lipinig,\t I like red!\n",
      "I\n",
      "like\n"
     ]
    }
   ],
   "source": [
    "str1 = \"I like Python and Pandas!\"\n",
    "str2 = \"I am lipinig,\\t I like red!\"\n",
    "print(\"字符串变量str1:\",str1)\n",
    "print(\"字符串变量str2:\",str2)\n",
    "print(str1[0])\n",
    "print(str1[2:6])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "6311bc4c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入工人的姓名：温\n",
      "请输入工人的性别：男\n",
      "请输入工人的工资：5900.39\n",
      "工人的姓名为：温\t性别为：男\t工资为：5900.390000\n",
      "工人的姓名为温 性别为 男工资为 5900.39\n"
     ]
    }
   ],
   "source": [
    "workname = input(\"请输入工人的姓名：\")\n",
    "worksex = input(\"请输入工人的性别：\")\n",
    "wrokwage = input(\"请输入工人的工资：\")\n",
    "print(\"工人的姓名为：%s\\t性别为：%s\\t工资为：%f\" %(workname,worksex,float(wrokwage)))\n",
    "print(f\"工人的姓名为{workname} 性别为 {worksex}工资为 {wrokwage}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "6d7cb813",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a集合中的元素： {'I', 't', '!', 'P', 'y', 'e', 'o', 'l', 'k', 'i', ' ', 'h', 'n'} \n",
      "\n",
      "b集合中的元素： {'I', 'a', 'v', 't', '!', 'e', 'o', 'l', 'k', 'i', ' ', 'J'} \n",
      "\n",
      "a和b差值： {'h', 'P', 'y', 'n'}\n",
      "a和b并值： {'a', 'P', 'k', ' ', 'n', 'I', 't', '!', 'v', 'y', 'e', 'o', 'l', 'i', 'h', 'J'}\n",
      "a和b交值： {'I', 't', '!', 'e', 'o', 'l', 'k', 'i', ' '}\n",
      "a和b中不同时存在的元素： {'a', 'v', 'P', 'y', 'h', 'J', 'n'}\n",
      "a和b的真子集： False\n",
      "a和b的子集： False\n",
      "a和b的真超集： False\n",
      "a和b的超集:  False\n",
      "a和b不相等： True\n",
      "False\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "# 集合运算\n",
    "a = set('I like Python!')\n",
    "b = set('I like Java too!')\n",
    "c = set(\"I like Go\")\n",
    "print(\"a集合中的元素：\",a,\"\\n\")\n",
    "print(\"b集合中的元素：\",b,\"\\n\")\n",
    "print(\"a和b差值：\",a-b)\n",
    "print(\"a和b并值：\",a|b)\n",
    "print(\"a和b交值：\",a&b)\n",
    "print(\"a和b中不同时存在的元素：\",a^b)\n",
    "print(\"a和b的真子集：\",a<b)\n",
    "print(\"a和b的子集：\",a<=b)\n",
    "print(\"a和b的真超集：\",a>b)\n",
    "print(\"a和b的超集: \",a>=b)\n",
    "print(\"a和b不相等：\",a!=b)\n",
    "print(a in b)\n",
    "print(a not in b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7923414a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
